#ifndef GAME_H
#define GAME_H

#include <QWidget>
#include<qpainter.h>
#include<qtimer.h>
#include<QKeyEvent>
#include<qstring.h>

namespace Ui {
class game;
}

class game : public QWidget
{
    Q_OBJECT

public:
    explicit game(QWidget *parent = 0);
    ~game();
    void paintEvent(QPaintEvent *event);
    void InitCat();
    
    QRect CreateRock_1();
    QRect CreateRock_2();
    QRect CreateRock_3();
    QRect CreateRock_4();
    QRect CreateRock_5();
    QRect CreateRock_6();
    QRect CreateRock_7();
    QRect CreateRock_8();
    QRect CreateRock_9();
    QRect CreateRock_10();
    void IsHit_rock_1();
    void IsHit_rock_2();
    void IsHit_rock_3();
    void IsHit_rock_4();
    void IsHit_rock_5();
    void IsHit_rock_6();
    void IsHit_rock_7();
    void IsHit_rock_8();
    void IsHit_rock_9();
    void IsHit_rock_10();
    QRect CreateBee_1();
    QRect CreateBee_2();
    void IsHit_bee_1();
    void IsHit_bee_2();
    bool is_bee_1;
    bool is_bee_2;
    bool is_rock_group_1;
    void IsHit_recovery();
    void IsHit_healing();
    void IsHit_gainpower();
    QRect CreateRecovery();
    QRect CreateHealing();
    QRect CreateGainpower();
    int cat_type;

private slots:
    void Cat_update();
    void rock_1_update();
    void rock_2_update();
    void rock_3_update();
    void rock_4_update();
    void rock_5_update();
    void rock_6_update();
    void rock_7_update();
    void rock_8_update();
    void rock_9_update();
    void rock_10_update();
    void run_time_update();
    void bee_1_on();
    void bee_2_on();
    void rock_group_1_on();
    void bee_1_update();
    void bee_2_update();
    void rock_move_step_update();
    void recovery_update();
    void healing_update();
    void power_update();
    void gainpower_update();

    void on_pushButton_clicked();

private:
    Ui::game *ui;
    QRect vCatRect;
    void keyPressEvent(QKeyEvent *key);
    void keyReleaseEvent(QKeyEvent *key);
    QTimer *timer;
    QTimer *timer_1;
    QTimer *timer_2;
    int run_time=0;
    int Hp;
    int power;
    bool blsRun;
    bool blsOver;
    bool blsPause;
    QString sDisplay;
    int nDirection;
    int Cat_step=1;
    QRect rock_1;
    QRect rock_2;
    QRect rock_3;
    QRect rock_4;
    QRect rock_5;
    QRect rock_6;
    QRect rock_7;
    QRect rock_8;
    QRect rock_9;
    QRect rock_10;
    QRect Bee_1;
    QRect Bee_2;
    int bee_1_move_step=0;
    int bee_2_move_step=0;
    int rock_move_step=1;
    int hit_times=0;
    int power_lose=1;
    QRect recovery;
    QRect healing;
    QRect gainpower;
};


#endif // GAME_H
